﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace SMG.Monitor.Domain.Models
{
    /// <summary>
    /// 节目单列表
    [Serializable]
    [XmlRoot("BroadcastList", Namespace = "")]
    /// </summary>
    public class BroadcastList
    {
        #region 节目单基本属性

        [XmlElement("ListId")]
        public String ListId { get; set; }

        /// <summary>
        /// 频道
        /// </summary>
        [XmlElement("ChannelId")]
        public String ChannelId { get; set; }
        /// <summary>
        /// 播出日期
        /// 格式yyyy-MM-dd
        /// </summary>
        [XmlElement("PlayDate")]
        public String PlayDate { get; set; }
        /// <summary>
        /// 节目单名称
        /// </summary>
        [XmlElement("ListName")]
        public String ListName { get; set; }
        /// <summary>
        /// 节目单类型
        /// 0总编室节目单，1广告单，2未合并广告播出频道节目单，3合并广告播出频道节目单，4播后节目单
        /// </summary>
        [XmlElement("ListType")]
        public String ListType { get; set; }
        /// <summary>
        /// 节目单版本
        /// 表示节目单版本号，从1开始递增
        /// </summary>
        [XmlElement("Version")]
        public String Version { get; set; }
        /// <summary>
        /// 图文播出信息
        /// 包括图文播出时间等
        /// </summary>
        [XmlElement("Subtitles")]
        public String Subtitles { get; set; }

        #endregion

        public String TuwenVersion { get; set; }

        #region 创建|修改|审核
        
        /// <summary>
        /// 创建时间
        /// </summary>
        public String CreateTime { get; set; }
        /// <summary>
        /// 创建人
        /// 例如用户名
        /// </summary>
        public String Creator { get; set; }
        /// <summary>
        /// 修改时间
        /// </summary>
        public String EditTime { get; set; }
        /// <summary>
        /// 修改人
        /// </summary>
        public String Editor { get; set; }
        /// <summary>
        /// 审核时间
        /// </summary>
        public String AuditTime { get; set; }
        /// <summary>
        /// 审核人
        /// </summary>
        public String Auditor { get; set; }

        #endregion

        /// <summary>
        /// 节目单列表
        /// </summary>
        [XmlElement("ListItem")]
        public List<BroadcastDetail> ListItem { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public String PlayItemVersion { get; set; }

        [XmlElement("TIMING")]
        public TIMING TIMING { get; set; }
        
    }

    /// <summary>
    /// 节目单详细
    /// </summary>
    [Serializable]
    [XmlRoot("BroadcastDetail")]
    public class BroadcastDetail {
        /// <summary>
        /// 节目单条目id
        /// </summary>
        [XmlElement("ItemId")]
        public String ItemId { get; set; }
        /// <summary>
        /// 节目序号
        /// </summary>
        [XmlElement("ItemIndex")]
        public String ItemIndex { get; set; }
        /// <summary>
        /// 节目标题
        /// </summary>
        [XmlElement("ProgramTitle")]
        public String ProgramTitle { get; set; }
        /// <summary>
        /// 播出日期
        /// 格式yyyy-MM-dd
        /// </summary>
        [XmlElement("PlayDate")]
        public String PlayDate { get; set; }
        /// <summary>
        /// 播出时间
        /// 格式hh:mm:ss:ff
        /// </summary>
        [XmlElement("PlayTime")]
        public String PlayTime { get; set; }
        /// <summary>
        /// 条目类型
        /// int,0普通节目；1广告段
        /// </summary>
        [XmlElement("ItemType")]
        public String ItemType { get; set; }
        /// <summary>
        /// 节目代码
        /// 24位，节目及广告段长度统一
        /// </summary>
        [XmlElement("ProgramId")]
        public String ProgramId { get; set; }
        /// <summary>
        /// 时间码起始点
        /// int,单位：帧
        /// </summary>
        [XmlElement("InPoint")]
        public Int32 InPoint { get; set; }
        /// <summary>
        /// 时间码结束点
        /// int,单位：帧
        /// </summary>
        [XmlElement("OutPoint")]
        public Int32 OutPoint { get; set; }
        /// <summary>
        /// 播出长度
        /// 播出长度=时间码结束点-时间码起始点
        /// </summary>
        [XmlElement("Duration")]
        public String Duration { get; set; }
        /// <summary>
        /// 播放设备id
        /// 唯一标识一个播出设备。对于直播，信号准备会调度通道，即指定id,
        /// 对于热炒录像机，当某些频道配有固有录像机时直接读取配置,当使用快速共享时还是由快速共享分配录像机,
        /// 指定通道；对于热炒服务器节目，指定相应的热炒服务器的id。
        /// </summary>
        [XmlElement("PlayDeviceId")]
        public String PlayDeviceId { get; set; }
        /// <summary>
        /// 演播室名称
        /// </summary>
        [XmlElement("StudioName")]
        public String StudioName { get; set; }
        /// <summary>
        /// 播出方式
        /// </summary>
        [XmlElement("PlayPattern")]
        public String PlayPattern { get; set; }
        [XmlElement("TapeId")]
        public String TapeId { get; set; }
        [XmlElement("ProgramSource")]
        public String ProgramSource { get; set; }
        /// <summary>
        /// 磁带入点
        /// </summary>
        [XmlElement("TapeInPoint")]
        public String TapeInPoint { get; set; }
        /// <summary>
        /// 磁带出点
        /// </summary>
        [XmlElement("TapeOutPoint")]
        public String TapeOutPoint { get; set; }
        public String TapeType { get; set; }
        /// <summary>
        /// 播出类型
        /// int,1定时播,2顺播,3手工触发,4定时插播,5相对插播,6连续插播,7手工插播
        /// </summary>
        [XmlElement("PlayMode")]
        public String PlayMode { get; set; }
        /// <summary>
        /// 节目类型
        /// </summary>
        [XmlElement("ProgramType")]
        public String ProgramType { get; set; }
        /// <summary>
        /// 重播标志
        /// int, 0未知,1首播,2重播,3明日要重播,4隔日重播
        /// </summary>
        [XmlElement("ReplaySymbol")]
        public String ReplaySymbol { get; set; }
        /// <summary>
        /// 入库形式
        /// int,0 文件迁移，1磁带上载
        /// </summary>
        [XmlElement("ProgramLibMode")]
        public String ProgramLibMode { get; set; }

        [XmlElement("ProgramKey")]
        public List<ProgramKey> ProgramKey { get; set; }
        /// <summary>
        /// 幅型变换
        /// int,0空,1信封,2切边,3变形
        /// </summary>
        [XmlElement("Afd")]
        public String Afd { get; set; }
        /// <summary>
        /// 高标清版本标识
        /// 0 标清；1 高清
        /// </summary>
        [XmlElement("IsHD")]
        public String IsHD { get; set; }
        /// <summary>
        /// 注释
        /// </summary>
        [XmlElement("Notation")]
        public String Notation { get; set; }
        /// <summary>
        /// 0不需要CueTone,1需要
        /// </summary>
        [XmlElement("CueTone")]
        public String CueTone { get; set; }

        [XmlElement("CG")]
        public CG CG { get; set; }
    }

    /// <summary>
    /// 节目键
    /// </summary>
    [Serializable]
    [XmlRoot("ProgramKey")]
    public class ProgramKey {
        /// <summary>
        /// 键编号
        /// int,代表1,2,3,4键
        /// </summary>
        [XmlElement("KeyNo")]
        public Int32 KeyNo { get; set; }
        /// <summary>
        /// 键模板
        /// 图文模板标识
        /// </summary>
        [XmlElement("KeyIndex")]
        public Int32 KeyIndex { get; set; }
        /// <summary>
        /// 键的状态
        /// 0上键,1下键,2保持
        /// </summary>
        [XmlElement("KeyStatus")]
        public Int32 KeyStatus { get; set; }
    }

    [Serializable]
    [XmlRoot("TIMING")]
    public class TIMING {
        [XmlElement("CG")]
        public CG CG { get; set; }
    }

    [Serializable]
    [XmlRoot("CG")]
    public class CG {
        [XmlElement("ITEM")]
        public List<Item> Item { get; set; }
    }

    [Serializable]
    [XmlRoot("ITEM")]
    public class Item{
        [XmlElement("TPLID")]
        public String TPLID { get; set; }
        [XmlElement("TPLType")]
        public String TPLType { get; set; }
        [XmlElement("StartTime")]
        public String StartTime { get; set; }
        [XmlElement("DurTime")]
        public String DurTime { get; set; }
        [XmlElement("EndTime")]
        public String EndTime { get; set; }
        [XmlElement("Interval")]
        public String Interval { get; set; }
        [XmlElement("PlayType")]
        public String PlayType { get; set; }
        [XmlElement("PlayTimes")]
        public String PlayTimes { get; set; }
        [XmlElement("SubEndTime")]
        public String SubEndTime { get; set; }
        [XmlElement("LoopCount")]
        public String LoopCount { get; set; }

        [XmlElement("LoopSpan")]
        public String LoopSpan { get; set; }
        [XmlElement("EOffSet")]
        public String EOffSet { get; set; }
        [XmlElement("IsHD")]
        public String IsHD { get; set; }
        [XmlElement("Layer")]
        public String Layer { get; set; }

        [XmlElement("CGItemID")]
        public String CGItemID { get; set; }

        [XmlArray("Elements")]
        public List<Element> Elements { get; set; }
    }

    [Serializable]
    public class Element {
        [XmlElement("EID")]
        public String EID { get; set; }
        [XmlElement("BatchId")]
        public String BatchId { get; set; }
        [XmlElement("ExtendAttribute")]
        public ExtendAttribute ExtendAttribute { get; set; }
    }

    [Serializable]
    public class ExtendAttribute {
        [XmlElement("AttributeName")]
        public String AttributeName { get; set; }
        [XmlElement("AttributeValue")]
        public String AttributeValue { get; set; }
        [XmlElement("isMain")]
        public String isMain { get; set; }
        [XmlElement("AttributeType")]
        public String AttributeType { get; set; }
    }

    

}
